package com.hmall.client;

import com.hmall.common.dto.Item;
import com.hmall.common.dto.PageDTO;
import com.hmall.handler.MyFeignInterceptor;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 远程调用
 *
 * @author zhang
 * @date 2022/06/12
 */
@FeignClient(value = "itemservice",configuration = {MyFeignInterceptor.class})
public interface ItemFeignClient {
    /**
     * 分页查询商品数据
     *
     * @param page 当前页数
     * @param size 每页总数量
     * @return {@link PageDTO}<{@link Item}>
     */
    @GetMapping("/item/list")
    PageDTO<Item> getItemByPage(@RequestParam Integer page, @RequestParam Integer size);

    /**
     * 根据ID查询指定商品
     *
     * @param id 商品编号
     * @return {@link Item}
     */
    @GetMapping("/item/{id}")
    Item getItemByID(@PathVariable("id") Long id);
}
